//
//  YWEwinManager.h
//  maintain
//
//  Created by Kyo on 16/7/1.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YWSingleton.h"

static NSString *const ewinMenuEnName_notice = @"notice";
static NSString *const ewinMenuEnName_work_task = @"work_task";
static NSString *const ewinMenuEnName_report_malfunction = @"report_malfunction";
static NSString *const ewinMenuEnName_keep_watch = @"keep_watch";
static NSString *const ewinMenuEnName_inspection = @"inspection";
static NSString *const ewinMenuEnName_detection = @"detection";
static NSString *const ewinMenuEnName_upkeep = @"upkeep";
static NSString *const ewinMenuEnName_repair = @"repair";
static NSString *const ewinMenuEnName_meter = @"meter";
static NSString *const ewinMenuEnName_attendance = @"attendance";
static NSString *const ewinMenuEnName_contacts = @"contacts";
static NSString *const ewinMenuEnName_repository = @"repository";
static NSString *const ewinMenuEnName_material = @"material";

typedef NS_ENUM(NSUInteger, YWUnReadCountType) {
    YWUnReadCountTypeAll = 0, //
    YWUnReadCountTypeNotice = 1, // 通知
    YWUnReadCountTypeTask = 2, //临时任务
    YWUnReadCountTypeTrouble = 3,//报障
    YWUnReadCountTypeFixTrouble = 4,//维修
    YWUnReadCountTypeInspection = 5,//巡查
    YWUnReadCountTypeKeepWatch = 6,//巡更
    YWUnReadCountTypeUpkeep = 7,//保养
    YWUnReadCountTypeDetection = 8,//检测
    YWUnReadCountTypeMaterial = 9,//物料
    YWUnReadCountTypeUnDistributionTroubleTotal = 10,//抢单
    YWUnReadCountTypeRemind = 11,//提醒
    YWUnReadCountTypeMonitorAlarm = 12,//监控报警
};

@class YWUnReadCount;
@class YWHandler;

@interface YWEwinManager : NSObject
YWSingletonH(Manager)

- (void)requestLoginUserInfoWithComplete:(void(^)(NSInteger statusCode))complete;
/**
 *  上传设备信息
 *
 *  @param deviceToken deviceToken
 *  @param isLogin
 *
 */
- (void)uploadDeviceInfoWithDeviceToken:(NSString*)deviceToken IsLogin:(NSInteger)isLogin WithComplete:(void(^)(NSInteger statusCode))complete;
/**
 *  退出登录
 *
 *  @param deviceToken deviceToken
 *
 */
- (void)requestLogoutWithDeviceToken:(NSString*)deviceToken WithComplete:(void(^)(NSInteger statusCode))complete;
/**
 *  请求更新一些数据
 *
 *  @return 无
 *
 */
- (void)requestDatas;
/**
 *  请求无二维码的权限
 *
 *  @return 无
 *
 */
- (void)requesNoQrcodeRightsWithBlock:(void(^)(BOOL succeed))complete;
/**
 *  网络状态变化调用
 *
 *  @return 无
 *
 */
- (void)netWorkStatusChange:(BOOL)existNetwork;
/**
 *  保存菜单
 *
 *  @return 结果
 */
- (BOOL)saveEwinMenuWithArray:(NSArray*)menuArray;

/**
 *  获取菜单
 *
 *  @return 结果
 */
- (NSArray*)ewinMenuWithMenuEnName:(NSString*)enName;
/**
 *  获取菜单名称
 *
 *  @return 结果
 */
- (NSString*)menuNameWithPersimissionMenuName:(NSString*)name;

/**
 *  启动时查询各个模块未读数,减少工作提醒对于推送的依赖
 *
 *  @return 结果
 */
- (void)selectIsExistNewMissionsUnReadCount;
/**
 *  保存上次阅读时间
 *
 *  @return 结果
 */
- (BOOL)saveLastReadTime:(NSTimeInterval)lastReadTime type:(YWUnReadCountType)unReadType;

/**
 *  保存各个模块的总数
 *
 *  @return 结果
 */
- (BOOL)updateTotalCount:(YWUnReadCount*)unreadCount;
/**
 *  获取各个模块的总数
 *
 *  @return 结果
 */
- (YWUnReadCount*)totalCount;
/**
 *  总数＋1
 *
 *  @return 结果
 */
- (void)addTotalCountWithType:(YWUnReadCountType)unReadType;
/**
 *  总数－1
 *
 *  @return 结果
 */
- (void)subtractTotalCountWithType:(YWUnReadCountType)unReadType;
/**
 *  添加参与者
 *
 *  @return 结果
 */
- (void)addObserver:(YWHandler*)handler relationId:(NSString*)relationId type:(NSInteger)type complete:(void(^)(BOOL succeed))complete;
/**
 *  删除参与者
 *
 *  @return 结果
 */
- (void)deleteObserver:(YWHandler*)handler relationId:(NSString*)relationId type:(NSInteger)type complete:(void(^)(BOOL succeed))complete;
@end
